<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateProductSkusTable extends Migration
{
    /**
     * Run the migrations.
     *商品的sku
     * @return void
     */
    public function up()
    {
        Schema::create('product_skus', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('product_id')->index()->comment('商品的id');
            $table->json('attrs')->comment('商品的sku名称');
            $table->json('sku')->comment('商品的sku属性 ');
            $table->unsignedInteger('stock')->comment('库存');
            $table->decimal('price')->comment('商品的价格');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('product_skus');
    }
}
